<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
   <include file="Public/breadcrumb"/>
    <section class="content">
    <!-- Main content -->
    <!--<div class="container-fluid">-->
    <div class="row">
      <div class="col-sm-12">
        <div class="panel panel-default">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-list"></i> 添加业务员</h3>
            </div>
            <div class="panel-body">
                <form action="" method="post" onsubmit="return checkUserUpdate(this);" enctype="multipart/form-data" >
                  <input type="hidden" name="id" value="{$sales.id}"/>
                    <table class="table table-bordered">
                    <tbody>
                    <tr>
                        <td class="col-sm-2">昵称:</td>
                        <td ><input type="text" class="form-control" name="nickname" value="{$sales.nickname}"></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="col-sm-2">真实姓名:</td>
                        <td ><input type="text" class="form-control" name="name" value="{$sales.name}"></td>
                        <td></td>
                    </tr>
                    <!--<tr>-->
                        <!--<td>登陆密码:</td>-->
                        <!--<td><input type="password" class="form-control" name="password"></td>-->
                        <!--<td>6-16位字母数字符号组合</td>-->
                    <!--</tr>-->


                    <tr>
                        <td>性别:</td>
                        <td id="order-status">
                            <input name="sex" type="radio" value="0" <if condition="$sales['sex'] eq 0">checked</if> >保密
                            <input name="sex" type="radio" value="1" <if condition="$sales['sex'] eq 1">checked</if> >男
                            <input name="sex" type="radio" value="2" <if condition="$sales['sex'] eq 2">checked</if> >女
                        </td>
                        <td></td>
                    </tr>

                    <tr>
                        <td class="col-sm-2">等级:</td>
                        <td >
                            <select name="level" id="level" class="form-control">
                                <option value="0">--选择等级--</option>
                                <foreach name="cate_list" item="v" key="k" >
                                    <option value="{$v.id}" <if condition="$sales[level] eq $v[id]">selected</if>>{$v.name}</option>
                                </foreach>
                            </select>
                            <!--<input type="text" class="form-control" name="name" value="{$sales.name}">-->
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>邮件地址:</td>
                        <td><input type="text" class="form-control" name="email" value="{$sales.email}"></td>
                    </tr>
                    <tr>
                        <td>QQ:</td>
                        <td>
                            <input class="form-control" type="text" name="qq" value="{$sales.qq}">
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>手机:</td>
                        <td>
                            <input type="text" class="form-control" name="mobile" value="{$sales.mobile}">
                        </td>
                    </tr>

                    <tr>
                        <td>上传头像:</td>
                        <td>
                            <input type="button" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back1');"/>
                            <input type="text" class="input-sm"  name="head_img" id="head_img" value="{$sales.head_img}"/>
                            <if condition="$sales['head_img'] neq null">
                                &nbsp;&nbsp;
                                <a target="_blank" href="{$sales.head_img}" id="head_img1">
                                    <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                </a>
                            </if>
                        </td>
                    </tr>



          
                    <tr>
                        <td></td>
                        <td>
                            <button type="submit" class="btn btn-info">
                                <i class="ace-icon fa fa-check bigger-110"></i> 保存
                            </button>
                            <input type="reset" class="btn btn-default pull-right" value="重置">
                        </td>
                    </tr>
                    </tbody>
                </table>
                </form>

            </div>
        </div>
 	  </div> 
    </div>    <!-- /.content -->
   </section>
</div>
<script>


    // 上传商品图片成功回调函数
    function call_back1(fileurl_tmp){
        $("#head_img").val(fileurl_tmp);
        $("#head_img1").attr('href', fileurl_tmp);
    }


    function checkUserUpdate(){
        var email = $('input[name="email"]').val();
        var nickname = $('input[name="nickname"]').val();
        var name = $('input[name="name"]').val();
        var mobile = $('input[name="mobile"]').val();
        var hear_img = $('input[name="hear_img"]').val();
        var error ='';


        if(nickname == ''  ){
            error += "昵称不能为空\n";
        }
        if(name == ''  ){
            error += "真实姓名不能为空\n";
        }
        
        if(email == ''  ){
        	 error += "email不能为空\n";
        }
        if(mobile ==''){
            error += "手机不能为空\n";
        }

        if(!checkEmail(email) && email != ''){
            error += "邮箱地址有误\n";
        }
        if(!checkMobile(mobile) && mobile != ''){
            error += "手机号码填写有误\n";
        }
        if(hear_img == ''  ){
            error += "头像不能为空\n";
        }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>